<link rel="stylesheet" href="/public/stylesheets/plugins/ztree/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="/public/javascripts/jquery.ztree.all.min.js"></script>
<style type="text/css">
<!--
   .ztree{
        padding: 40px 0px 0px 50px;
   }
-->
</style>
<div class="modal-header">
   <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
   <span class="modal-title">角色详情</span>
   </div>
   <div class="modal-body">
        <div class="box-body">
                    <div class="form-group col-md-6">
                    <label>角色名：</label>
                    ${role?.name}
                    </div>
            
                   <input type="hidden" name="sele_pids" value="${params['sele_pids']?params['sele_pids']:ids}" id="sele_pids"/>    

        <div id="permission_tree" style="margin-top: 40px;">
           <ul id="authTree" class="ztree"></ul>
        </div>
    
         <input type="hidden" name="pcodes" value="${array}" id="pcodes"/>
   
        </div>
   </div>
        <script type="text/javascript">
        <!--
        var setting = {
            check: {
                enable: false
            },
            data: {
                simpleData: {
                    enable: true
                }
            }
        };

        $(document).ready(function(){
            var _nodesStr= $('#pcodes').val();
            var zNodes=JSON.parse(_nodesStr);
            $.fn.zTree.init($("#authTree"), setting, zNodes);
            updateTree();
        });
        //-->
     
        function getTree(){
            return $.fn.zTree.getZTreeObj("authTree");
        }
        
        function updateTree(){
            var ids = $('#sele_pids').val();
            var arr = ids.split(",");
            var zTree = getTree();
            var node;
            for(var i=0;i<arr.length;i++){
                node = zTree.getNodeByParam("id",arr[i],null);
                if(!node.isParent){
                    zTree.checkNode(node,true,true);
                }
            }
            
            
        }

     </script>  